<template>
  <div>
    <!-- 1.拆分组件 -->
    <el-button type="primary" @click="willAdd">添加</el-button>
    <!-- 列表 -->
    <v-list @willUpdate="willUpdate" :list="list" @init="init"></v-list>
    <!-- 弹框 -->
    <v-form :status="status" :list="list" @init="init" ref="form"></v-form>
  </div>
</template>
<script>
import { reqmenulist } from "../../http/api";
import vList from "./components/list.vue";
import vForm from "./components/form.vue";
import {mixin} from"../../mixins/index"
export default {
  components: {
    vList,
    vForm,
  },
  mixins:[mixin],
  props: [],
  data() {
    return {
      list: [],
    };
  },
  methods: {
    //数据
    init() {
      reqmenulist({
        istree: true,
      }).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.list;
        }
      });
    },
  },
  mounted() {
    //请求数据
    this.init();
  },
  computed: {},
  watch: {},
};
</script>
<style scoped lang="less">
@import "../../less/index.less";
</style>
